<template>
  <div class="app-container">
    <el-card>
      <div style="margin-top: 15px;">
        <el-form :inline="true" size="small" label-width="140px">
          <el-form-item label="区域名称:">
            <el-input v-model="tempSearchObj.regionName" placeholder="请输入区域名称" />
          </el-form-item>
          <el-button type="primary" icon="el-icon-search" @click="getRegion()">查询</el-button>
          <el-button type="default" @click="resetSearch()">清空</el-button>
        </el-form>
      </div>
    </el-card>
    <!-- 工具条 -->
    <el-card class="operate-container" shadow="never">
      <i class="el-icon-tickets" style="margin-top: 5px"></i>
      <span style="margin-top: 5px">数据列表</span>
      <el-button class="btn-add" size="mini" @click="showAddRegion">添 加</el-button>
      <el-button class="btn-add" size="mini" @click="revomveRegions" :disabled="selectedIds.length === 0"
        style="margin: 0 10px;">批量删除</el-button>
    </el-card>
    <!-- banner列表 -->
    <el-table v-loading="listLoading" :data="users" stripe border style="width: 100%;margin-top: 10px;"
      @selection-change="handleSelectionChange">

      <el-table-column type="selection" width="55" />

      <el-table-column type="index" label="序号" width="80" align="center" />
      <el-table-column prop="name" label="名称" width="120" />
      <el-table-column prop="createTime" label="创建时间" width="180" />
      <el-table-column prop="updateTime" label="更新时间" width="180" />

      <el-table-column label="操作" width="220" align="center">
        <template slot-scope="scope">
          <el-button type="text" size="mini" @click="showUpdateRegion(scope.row)">修改</el-button>
          <el-button type="text" size="mini" @click="removeRegion(scope.row.id)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页 -->
    <el-pagination :current-page="page" :total="total" :page-size="limit" :page-sizes="[5, 10, 20, 30, 40, 50, 100]"
      style="padding: 20px 0;" layout="prev, pager, next, jumper, ->, sizes, total" @current-change="getRegions"
      @size-change="handleSizeChange" />

    <el-dialog :title="region.id ? '修改区域' : '添加区域'" :visible.sync="dialogRegionVisible">
      <el-form ref="regionForm" :model="region" :rules="regionRules" label-width="120px">
        <el-form-item label="名称" prop="name">
          <el-input v-model="region.name" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="cancel">取 消</el-button>
        <el-button :loading="loading" type="primary" @click="addOrRegion">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import RegionApi from '@/api/sys/region'
export default {
  name: 'Region',

  data() {
    return {
      region: {
        regionName: ''
      }
    }
  },
  created() {

  },
  methods: {}
}
</script>